// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Plasma Emitter Object
// Script Author: Christan Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 79 : TYPE_PLASMAEMITTER


// Static Values

// Tables

event ObjectMain
	if object.state == 1
		object.animationTimer++
		object.animationTimer &= 7
		object.frame = object.animationTimer
		object.frame >>= 1
		object.frame++
		object.value0--
		if object.value0 <= 0
			object.state = 0
			object.frame = 0
			object.animationTimer = 0
		end if
		temp0 = oscillation
		temp0 &= 15
		if temp0 == 0
			PlaySfx(SfxName[Electric Arc], 0)
		end if
	end if
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		BoxCollisionTest(C_BOX, object.entityPos, -8, -24, 8, 8, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
	next
end event


event ObjectDraw
	DrawSprite(object.frame)
end event


event ObjectStartup
	LoadSpriteSheet("SBZ/Objects.gif")
	SpriteFrame(-8, -8, 16, 16, 162, 397)
	SpriteFrame(-8, -8, 16, 16, 179, 397)
	SpriteFrame(-8, -8, 16, 16, 196, 397)
	SpriteFrame(-8, -8, 16, 16, 179, 397)
	SpriteFrame(-8, -8, 16, 16, 213, 397)
	foreach (TypeName[Plasma Emitter], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].drawOrder = 4
	next
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
